<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
</head>
<link rel="icon" href="${pageContext.request.contextPath}/favicon.ico"  type="image/x-icon"/>
<link href="${pageContext.request.contextPath}/style/news.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
<script src="${pageContext.request.contextPath}/bootstrap/js/jQuery.js"></script>
<script src="${pageContext.request.contextPath}/bootstrap/js/bootstrap.js"></script>
<body>
<div class="data_list backMain">
	<div class="dataHeader navi">
		当前位置：&nbsp;&nbsp;
		主页&nbsp;&nbsp;&gt;&nbsp;&nbsp;
		新闻管理&nbsp;&nbsp;&gt;&nbsp;&nbsp;
		新闻列表&nbsp;&nbsp;
	</div>
	<div class="search_content" style="vertical-align: middle;">
		<form action="${pageContext.request.contextPath}/news" method="post">
			<input type="hidden" name="method" value="list" />
			新闻标题：<input type="text" id="s_title" name="s_title" style="width:180px" value=""/>&nbsp;&nbsp;
			发布日期：<input type="text" id="s_bPublishDate" name="s_bPublishDate" class="Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"   style="width: 100px;" value=""/>
			&nbsp;到&nbsp;<input type="text" id="s_aPublishDate" name="s_aPublishDate" class="Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" style="width: 100px;" value=""/>
			&nbsp;&nbsp;<button class="btn btn-mini btn-primary" type="submit" style="margin-top: -8px;">查询</button>
		</form>
	</div>
	<div class="data_content">
		<table class="table table-hover table-bordered">
			<tr>
				<th>序号</th>
				<th>新闻标题</th>
				<th>新闻类别</th>
				<th>发布时间</th>
				<th>操作</th>
			</tr>
			<c:forEach items="${list}" var="news" varStatus="in">
				<tr>
					<td>${in.count}</td>
					<td>${news.title}</td>
					<td>${news.tType.typeName}</td>
					<td>${news.publicDate}</td>
					<td>
						<button class="btn btn-mini btn-info" type="button" onclick="update(${news.id})">修改</button>
						&nbsp;<button class="btn btn-mini btn-danger" type="button" onclick="del(${news.id})">删除</button>
						<script>
							function update(id){
								location.href="${pageContext.request.contextPath}/news?method=updateUI&id="+id;
							}
							function del(id){
								if(confirm("你确定删除吗？"))
									location.href="${pageContext.request.contextPath}/news?method=del&id="+id;
							}
						</script>
					</td>
				</tr>
			</c:forEach>
		</table>
	</div>
</div>
</body>
</html>